package com.yc.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;

import java.util.List;
import java.util.Map;

/**
 * @Author dm
 * @Date 2023/7/27 21:25 （可以根据需要修改）
 * @Version 1.0 （版本号）
 */
@Mapper
public interface SchoolYearMapper {
    /**
    *@Description 获得所有的学年
    *@Return
    *@Author dm
    *@Date Created in 2023/8/2 10:53
    **/

    @Select("select distinct school_year from school_year")
    List<String> querySchoolYears();

    /**
    *@Description 获得指定学年的所有时间数据
    *@Return
    *@Author dm
    *@Date Created in 2023/8/2 10:53
    **/
    @Select("select time from school_year where school_year = #{school_year} and week = #{week}")
    List<String> queryXries(@Param("school_year") String school_year,@Param("week")String week);



    /**
    *@Description 批量添加学年日期数据
    *@Return
    *@Author dm
    *@Date Created in 2023/8/2 10:59
    **/
    boolean insertTimeData(@Param("times")List<String> times,
                           @Param("week")Integer week,
                           @Param("sy")String sy);

    /**
     * 根据开始日期获取周次
     * @param week
     * @return 日期
     */
    @Select("select time from school_year where week = #{week} and school_year=#{year} order by time asc")
    List<String> selectDateByWeek(@Param("week") String week,@Param("year") String year);
}
